/* This is an autogenerated file. Do not edit.  */

#include "bf16-check.h"
#include "defines.h"
#include "macros.h"
#include "args.h"

struct IntegerRegisters iregs;
struct FloatRegisters fregs;
unsigned int num_iregs, num_fregs;

/* This struct holds values for argument checking.  */
struct
{
  __bf16 f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14,
    f15, f16, f17, f18, f19, f20, f21, f22, f23;
} values___bf16;

void
fun_check_bf16_passing_8_values (__bf16 f0 ATTRIBUTE_UNUSED,
				 __bf16 f1 ATTRIBUTE_UNUSED,
				 __bf16 f2 ATTRIBUTE_UNUSED,
				 __bf16 f3 ATTRIBUTE_UNUSED,
				 __bf16 f4 ATTRIBUTE_UNUSED,
				 __bf16 f5 ATTRIBUTE_UNUSED,
				 __bf16 f6 ATTRIBUTE_UNUSED,
				 __bf16 f7 ATTRIBUTE_UNUSED)
{
  /* Check argument values.  */
  check_bf16 (values___bf16.f0, f0);
  check_bf16 (values___bf16.f1, f1);
  check_bf16 (values___bf16.f2, f2);
  check_bf16 (values___bf16.f3, f3);
  check_bf16 (values___bf16.f4, f4);
  check_bf16 (values___bf16.f5, f5);
  check_bf16 (values___bf16.f6, f6);
  check_bf16 (values___bf16.f7, f7);
}

void
fun_check_bf16_passing_8_regs (__bf16 f0 ATTRIBUTE_UNUSED,
			       __bf16 f1 ATTRIBUTE_UNUSED,
			       __bf16 f2 ATTRIBUTE_UNUSED,
			       __bf16 f3 ATTRIBUTE_UNUSED,
			       __bf16 f4 ATTRIBUTE_UNUSED,
			       __bf16 f5 ATTRIBUTE_UNUSED,
			       __bf16 f6 ATTRIBUTE_UNUSED,
			       __bf16 f7 ATTRIBUTE_UNUSED)
{
  /* Check register contents.  */
  check_bf16_arguments;
}

void
fun_check_bf16_passing_16_values (__bf16 f0 ATTRIBUTE_UNUSED,
				  __bf16 f1 ATTRIBUTE_UNUSED,
				  __bf16 f2 ATTRIBUTE_UNUSED,
				  __bf16 f3 ATTRIBUTE_UNUSED,
				  __bf16 f4 ATTRIBUTE_UNUSED,
				  __bf16 f5 ATTRIBUTE_UNUSED,
				  __bf16 f6 ATTRIBUTE_UNUSED,
				  __bf16 f7 ATTRIBUTE_UNUSED,
				  __bf16 f8 ATTRIBUTE_UNUSED,
				  __bf16 f9 ATTRIBUTE_UNUSED,
				  __bf16 f10 ATTRIBUTE_UNUSED,
				  __bf16 f11 ATTRIBUTE_UNUSED,
				  __bf16 f12 ATTRIBUTE_UNUSED,
				  __bf16 f13 ATTRIBUTE_UNUSED,
				  __bf16 f14 ATTRIBUTE_UNUSED,
				  __bf16 f15 ATTRIBUTE_UNUSED)
{
  /* Check argument values.  */
  check_bf16 (values___bf16.f0, f0);
  check_bf16 (values___bf16.f1, f1);
  check_bf16 (values___bf16.f2, f2);
  check_bf16 (values___bf16.f3, f3);
  check_bf16 (values___bf16.f4, f4);
  check_bf16 (values___bf16.f5, f5);
  check_bf16 (values___bf16.f6, f6);
  check_bf16 (values___bf16.f7, f7);
  check_bf16 (values___bf16.f8, f8);
  check_bf16 (values___bf16.f9, f9);
  check_bf16 (values___bf16.f10, f10);
  check_bf16 (values___bf16.f11, f11);
  check_bf16 (values___bf16.f12, f12);
  check_bf16 (values___bf16.f13, f13);
  check_bf16 (values___bf16.f14, f14);
  check_bf16 (values___bf16.f15, f15);
}

void
fun_check_bf16_passing_16_regs (__bf16 f0 ATTRIBUTE_UNUSED,
				__bf16 f1 ATTRIBUTE_UNUSED,
				__bf16 f2 ATTRIBUTE_UNUSED,
				__bf16 f3 ATTRIBUTE_UNUSED,
				__bf16 f4 ATTRIBUTE_UNUSED,
				__bf16 f5 ATTRIBUTE_UNUSED,
				__bf16 f6 ATTRIBUTE_UNUSED,
				__bf16 f7 ATTRIBUTE_UNUSED,
				__bf16 f8 ATTRIBUTE_UNUSED,
				__bf16 f9 ATTRIBUTE_UNUSED,
				__bf16 f10 ATTRIBUTE_UNUSED,
				__bf16 f11 ATTRIBUTE_UNUSED,
				__bf16 f12 ATTRIBUTE_UNUSED,
				__bf16 f13 ATTRIBUTE_UNUSED,
				__bf16 f14 ATTRIBUTE_UNUSED,
				__bf16 f15 ATTRIBUTE_UNUSED)
{
  /* Check register contents.  */
  check_bf16_arguments;
}

void
fun_check_bf16_passing_20_values (__bf16 f0 ATTRIBUTE_UNUSED,
				  __bf16 f1 ATTRIBUTE_UNUSED,
				  __bf16 f2 ATTRIBUTE_UNUSED,
				  __bf16 f3 ATTRIBUTE_UNUSED,
				  __bf16 f4 ATTRIBUTE_UNUSED,
				  __bf16 f5 ATTRIBUTE_UNUSED,
				  __bf16 f6 ATTRIBUTE_UNUSED,
				  __bf16 f7 ATTRIBUTE_UNUSED,
				  __bf16 f8 ATTRIBUTE_UNUSED,
				  __bf16 f9 ATTRIBUTE_UNUSED,
				  __bf16 f10 ATTRIBUTE_UNUSED,
				  __bf16 f11 ATTRIBUTE_UNUSED,
				  __bf16 f12 ATTRIBUTE_UNUSED,
				  __bf16 f13 ATTRIBUTE_UNUSED,
				  __bf16 f14 ATTRIBUTE_UNUSED,
				  __bf16 f15 ATTRIBUTE_UNUSED,
				  __bf16 f16 ATTRIBUTE_UNUSED,
				  __bf16 f17 ATTRIBUTE_UNUSED,
				  __bf16 f18 ATTRIBUTE_UNUSED,
				  __bf16 f19 ATTRIBUTE_UNUSED)
{
  /* Check argument values.  */
  check_bf16 (values___bf16.f0, f0);
  check_bf16 (values___bf16.f1, f1);
  check_bf16 (values___bf16.f2, f2);
  check_bf16 (values___bf16.f3, f3);
  check_bf16 (values___bf16.f4, f4);
  check_bf16 (values___bf16.f5, f5);
  check_bf16 (values___bf16.f6, f6);
  check_bf16 (values___bf16.f7, f7);
  check_bf16 (values___bf16.f8, f8);
  check_bf16 (values___bf16.f9, f9);
  check_bf16 (values___bf16.f10, f10);
  check_bf16 (values___bf16.f11, f11);
  check_bf16 (values___bf16.f12, f12);
  check_bf16 (values___bf16.f13, f13);
  check_bf16 (values___bf16.f14, f14);
  check_bf16 (values___bf16.f15, f15);
  check_bf16 (values___bf16.f16, f16);
  check_bf16 (values___bf16.f17, f17);
  check_bf16 (values___bf16.f18, f18);
  check_bf16 (values___bf16.f19, f19);
}

void
fun_check_bf16_passing_20_regs (__bf16 f0 ATTRIBUTE_UNUSED,
				__bf16 f1 ATTRIBUTE_UNUSED,
				__bf16 f2 ATTRIBUTE_UNUSED,
				__bf16 f3 ATTRIBUTE_UNUSED,
				__bf16 f4 ATTRIBUTE_UNUSED,
				__bf16 f5 ATTRIBUTE_UNUSED,
				__bf16 f6 ATTRIBUTE_UNUSED,
				__bf16 f7 ATTRIBUTE_UNUSED,
				__bf16 f8 ATTRIBUTE_UNUSED,
				__bf16 f9 ATTRIBUTE_UNUSED,
				__bf16 f10 ATTRIBUTE_UNUSED,
				__bf16 f11 ATTRIBUTE_UNUSED,
				__bf16 f12 ATTRIBUTE_UNUSED,
				__bf16 f13 ATTRIBUTE_UNUSED,
				__bf16 f14 ATTRIBUTE_UNUSED,
				__bf16 f15 ATTRIBUTE_UNUSED,
				__bf16 f16 ATTRIBUTE_UNUSED,
				__bf16 f17 ATTRIBUTE_UNUSED,
				__bf16 f18 ATTRIBUTE_UNUSED,
				__bf16 f19 ATTRIBUTE_UNUSED)
{
  /* Check register contents.  */
  check_bf16_arguments;
}

#define def_check_bf16_passing8(_f0, _f1, _f2, _f3, _f4, _f5, _f6,\
				   _f7, _func1, _func2, TYPE) \
  values_ ## TYPE .f0 = _f0; \
  values_ ## TYPE .f1 = _f1; \
  values_ ## TYPE .f2 = _f2; \
  values_ ## TYPE .f3 = _f3; \
  values_ ## TYPE .f4 = _f4; \
  values_ ## TYPE .f5 = _f5; \
  values_ ## TYPE .f6 = _f6; \
  values_ ## TYPE .f7 = _f7; \
  WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7); \
  clear_float_registers; \
  fregs.F0._ ## TYPE [0] = _f0; \
  fregs.F1._ ## TYPE [0] = _f1; \
  fregs.F2._ ## TYPE [0] = _f2; \
  fregs.F3._ ## TYPE [0] = _f3; \
  fregs.F4._ ## TYPE [0] = _f4; \
  fregs.F5._ ## TYPE [0] = _f5; \
  fregs.F6._ ## TYPE [0] = _f6; \
  fregs.F7._ ## TYPE [0] = _f7; \
  num_fregs = 8; \
  WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7);

#define def_check_bf16_passing16(_f0, _f1, _f2, _f3, _f4, _f5, _f6, \
				    _f7, _f8, _f9, _f10, _f11, _f12, _f13, \
				    _f14, _f15, _func1, _func2, TYPE) \
  values_ ## TYPE .f0 = _f0; \
  values_ ## TYPE .f1 = _f1; \
  values_ ## TYPE .f2 = _f2; \
  values_ ## TYPE .f3 = _f3; \
  values_ ## TYPE .f4 = _f4; \
  values_ ## TYPE .f5 = _f5; \
  values_ ## TYPE .f6 = _f6; \
  values_ ## TYPE .f7 = _f7; \
  values_ ## TYPE .f8 = _f8; \
  values_ ## TYPE .f9 = _f9; \
  values_ ## TYPE .f10 = _f10; \
  values_ ## TYPE .f11 = _f11; \
  values_ ## TYPE .f12 = _f12; \
  values_ ## TYPE .f13 = _f13; \
  values_ ## TYPE .f14 = _f14; \
  values_ ## TYPE .f15 = _f15; \
  WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, \
		     _f10, _f11, _f12, _f13, _f14, _f15); \
  clear_float_registers; \
  fregs.F0._ ## TYPE [0] = _f0; \
  fregs.F1._ ## TYPE [0] = _f1; \
  fregs.F2._ ## TYPE [0] = _f2; \
  fregs.F3._ ## TYPE [0] = _f3; \
  fregs.F4._ ## TYPE [0] = _f4; \
  fregs.F5._ ## TYPE [0] = _f5; \
  fregs.F6._ ## TYPE [0] = _f6; \
  fregs.F7._ ## TYPE [0] = _f7; \
  num_fregs = 8; \
  WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, \
		     _f10, _f11, _f12, _f13, _f14, _f15);

#define def_check_bf16_passing20(_f0, _f1, _f2, _f3, _f4, _f5, _f6, \
				    _f7, _f8, _f9, _f10, _f11, _f12, \
				    _f13, _f14, _f15, _f16, _f17, \
				    _f18, _f19, _func1, _func2, TYPE) \
  values_ ## TYPE .f0 = _f0; \
  values_ ## TYPE .f1 = _f1; \
  values_ ## TYPE .f2 = _f2; \
  values_ ## TYPE .f3 = _f3; \
  values_ ## TYPE .f4 = _f4; \
  values_ ## TYPE .f5 = _f5; \
  values_ ## TYPE .f6 = _f6; \
  values_ ## TYPE .f7 = _f7; \
  values_ ## TYPE .f8 = _f8; \
  values_ ## TYPE .f9 = _f9; \
  values_ ## TYPE .f10 = _f10; \
  values_ ## TYPE .f11 = _f11; \
  values_ ## TYPE .f12 = _f12; \
  values_ ## TYPE .f13 = _f13; \
  values_ ## TYPE .f14 = _f14; \
  values_ ## TYPE .f15 = _f15; \
  values_ ## TYPE .f16 = _f16; \
  values_ ## TYPE .f17 = _f17; \
  values_ ## TYPE .f18 = _f18; \
  values_ ## TYPE .f19 = _f19; \
  WRAP_CALL(_func1) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, \
		     _f9, _f10, _f11, _f12, _f13, _f14, _f15, _f16, \
		     _f17, _f18, _f19); \
  clear_float_registers; \
  fregs.F0._ ## TYPE [0] = _f0; \
  fregs.F1._ ## TYPE [0] = _f1; \
  fregs.F2._ ## TYPE [0] = _f2; \
  fregs.F3._ ## TYPE [0] = _f3; \
  fregs.F4._ ## TYPE [0] = _f4; \
  fregs.F5._ ## TYPE [0] = _f5; \
  fregs.F6._ ## TYPE [0] = _f6; \
  fregs.F7._ ## TYPE [0] = _f7; \
  num_fregs = 8; \
  WRAP_CALL(_func2) (_f0, _f1, _f2, _f3, _f4, _f5, _f6, _f7, _f8, _f9, \
		     _f10, _f11, _f12, _f13, _f14, _f15, _f16, _f17, \
		     _f18, _f19);

volatile __bf16 bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8, bf9, bf10,
		bf11,bf12,bf13,bf14,bf15,bf16,bf17,bf18,bf19,bf20;

void
test_bf16_on_stack ()
{
  def_check_bf16_passing8 (bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
			   fun_check_bf16_passing_8_values,
			   fun_check_bf16_passing_8_regs, __bf16);

  def_check_bf16_passing16 (bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8,
			    bf9, bf10,bf11,bf12,bf13,bf14,bf15,bf16,
			    fun_check_bf16_passing_16_values,
			    fun_check_bf16_passing_16_regs, __bf16);
}

void
test_too_many_bf16 ()
{
  def_check_bf16_passing20 (bf1, bf2, bf3, bf4, bf5, bf6, bf7, bf8, bf9, bf10,
			    bf11,bf12,bf13,bf14,bf15,bf16,bf17,bf18,bf19,bf20,
			    fun_check_bf16_passing_20_values,
			    fun_check_bf16_passing_20_regs, __bf16);
}

static void
do_test (void)
{
  test_bf16_on_stack ();
  test_too_many_bf16 ();
}
